<template>
  <!-- 内容左边区域 -->
  <el-menu
      router
      class="el-menu-vertical-demo"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b"
      :default-active="$route.path">
      <el-submenu :index="index+''" v-for="(menufa,index) in menuList" :key="menufa.id">
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>{{menufa.title}}</span>
        </template>
        <el-menu-item-group>
          <el-menu-item :index="menuSon.url" v-for="(menuSon) in menufa.children" :key="menuSon.id">{{menuSon.title}}</el-menu-item>
        </el-menu-item-group>
      </el-submenu>
    </el-menu>
</template>

<script>
export default {
  name: 'MyAside',
  data () {
    return {
      menuList: []
    }
  },
  methods: {
    getMenuList () {
      this.$requests('/menulist?istree=1').then(res => {
        this.menuList = res.list
      })
    }
  },
  mounted () {
    this.getMenuList()
  }
}
</script>

<style lang="less" scoped>
.el-menu-vertical-demo{
  width: 200px;
}
</style>
